/**
 * main component
 */

import React from 'react';
import PersonalContainer from '../PersonalContainer/PersonalContainer.jsx';
import PersonalList from '../PersonalList/PersonalList.jsx';
import PersonalSectionContainer from '../PersonalSectionContainer/PersonalSectionContainer.jsx'

class PersonalMainComponent extends React.Component {
    constructor(props) {
        super(props);
        /**
         * chosen:
         *  处理参数选择
         *  0: 学习进度
         *  1: 我的课程
         *  2: 我的作业
         *  3: 我的消息
         *  4: 系统通知
         *  5: 我的笔记
         *  6: 收藏夹
         */
        this.state = {
            chosen: 1
        };
        // this.chosen = this.state.chosen;

        this.handleChangeList.bind(this)
    }

    handleChangeList(obj) {
        // let self = this;
        // console.log(this);
        this.setState(obj, function () {
        });

        return obj;
    }

    render() {
        return (<PersonalContainer padding={true} minHeight={550}>
            <PersonalList emit={this.handleChangeList.bind(this)}/>
            <PersonalSectionContainer chosen={this.state.chosen}
                                      totalPage={this.props.totalPage}
                                      page={this.props.page}
                                      changePage={this.props.changePage}
                                      delHistory={this.props.delHistory}
                                      collectCourse={this.props.collectCourse}
                                      unCollectCourse={this.props.unCollectCourse}
                                      histories={this.props.histories}
                                      collectedCourses={this.props.collectedCourses}
                                      notes={this.props.notes}
                                      comments={this.props.comments}
                                      username={this.props.username}
                                      sign={this.props.sign}
            />
        </PersonalContainer>)
    }
}

PersonalMainComponent.PropTypes = {};
//
PersonalMainComponent.defaultProps = {};

PersonalMainComponent.displayName = 'PersonalMainComponent';

export default PersonalMainComponent;

